package fr.castorhoz.isi_connectivity_widget.BluetoothWidget;

import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.IntentFilter;
import fr.castorhoz.isi_connectivity_widget.ConnButton;
import fr.castorhoz.isi_connectivity_widget.R;

public class BluetoothButton extends ConnButton{
	

	public BluetoothButton(Context context) {
		// //RECEIVERS//////////////////////////////////////////////
		if (receiver == null)
			receiver = new BluetoothBroadcastReceiver(this);
		IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
		context.getApplicationContext().registerReceiver(receiver, filter);
		////////////////////////////////////////////////////////////
	}
	
	
	/////////////////TODO
	@Override
	public void enableNetwork(Context context) {
		BluetoothAdapter mgr = getBluetoothAdapter(context);
		mgr.enable();
	}

	@Override
	public void disableNetwork(Context context) {
		BluetoothAdapter mgr = getBluetoothAdapter(context);
		mgr.disable();

	}

	private BluetoothAdapter getBluetoothAdapter(Context context) {
		return BluetoothAdapter.getDefaultAdapter();
	}
	
	public String getAction(){
		return "fr.imberle.connectivityWidget.CLICK_GPS";
	}
	
	@Override
	public int getIdButton() {
		return  R.id.button_bluetooth;
	}
	
	@Override
	public int getSelectorOff() {
		return R.drawable.bluetooth_selector_off;
	}
	
	@Override
	public int getSelectorOn() {
		return R.drawable.bluetooth_selector_on;
	}
	
	@Override
	public int getSelectorUnknown() {
		// TODO Auto-generated method stub
		return R.drawable.bluetooth_selector_unknown;
	}



}
